package com.homegoods.resource.widget.moreText;

import android.content.Context;
import android.graphics.Canvas;
import android.support.v7.widget.AppCompatTextView;
import android.util.AttributeSet;

/**
 * @author QiQi
 * @ClassName: MoreTextView
 * @date 2018/10/16
 * @description
 */
public class MoreTextView extends AppCompatTextView {
    public MoreTextView(Context context) {
        this(context, null);
    }

    public MoreTextView(Context context, AttributeSet attrs) {
        this(context, attrs, android.R.attr.textViewStyle);
    }

    public MoreTextView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        Threed.init(this, attrs, defStyleAttr);
    }

    @Override
    protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) {
        super.onTextChanged(text, start, lengthBefore, lengthAfter);
        Threed.onTextChanged(this, text);
    }

    public void setMoreMaxLines(int maxLines) {
        super.setMaxLines(maxLines);
        Threed.setMaxLines(this, maxLines);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        Threed.onDraw(this);
        super.onDraw(canvas);
    }

    public void setOnEllipsizeChangeListener(OnEllipsizeChangeListener onEllipsizeChangeListener) {
        Threed.setOnEllipsizeChangeListener(this, onEllipsizeChangeListener);
    }
}
